<?php
/* Smarty version 5.5.2, created on 2025-10-02 15:00:52
  from 'file:index/login.tpl' */

/* @var \Smarty\Template $_smarty_tpl */
if ($_smarty_tpl->getCompiled()->isFresh($_smarty_tpl, array (
  'version' => '5.5.2',
  'unifunc' => 'content_68de23245959b6_41060953',
  'has_nocache_code' => false,
  'file_dependency' => 
  array (
    '577b3979f5b88da1d6b1c499fc2f086adc88b1c6' => 
    array (
      0 => 'index/login.tpl',
      1 => 1759373506,
      2 => 'file',
    ),
  ),
  'includes' => 
  array (
  ),
))) {
function content_68de23245959b6_41060953 (\Smarty\Template $_smarty_tpl) {
$_smarty_current_dir = 'D:\\phpstudy_pro\\WWW\\Blog\\Admin\\View\\index';
?><!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>博客管理系统 - 管理员登录</title>
    <style>
        * {
            margin: 0;
            padding: 0;
            box-sizing: border-box;
        }
        
        body {
            font-family: 'Microsoft YaHei', Arial, sans-serif;
            background-color: #f5f5f5;
            display: flex;
            justify-content: center;
            align-items: center;
            height: 100vh;
            background-image: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
        }
        
        .login-container {
            background-color: #fff;
            border-radius: 10px;
            box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
            padding: 40px;
            width: 100%;
            max-width: 400px;
            transition: transform 0.3s ease;
        }
        
        .login-container:hover {
            transform: translateY(-5px);
        }
        
        .login-header {
            text-align: center;
            margin-bottom: 30px;
        }
        
        .login-header h2 {
            color: #333;
            font-size: 24px;
            font-weight: 600;
            margin-bottom: 10px;
        }
        
        .login-header p {
            color: #666;
            font-size: 14px;
        }
        
        .form-group {
            margin-bottom: 20px;
        }
        
        .form-group label {
            display: block;
            margin-bottom: 8px;
            color: #333;
            font-weight: 500;
            font-size: 14px;
        }
        
        .form-group input {
            width: 100%;
            padding: 12px 15px;
            border: 2px solid #e0e0e0;
            border-radius: 6px;
            font-size: 14px;
            transition: border-color 0.3s ease;
            font-family: inherit;
        }
        
        .form-group input:focus {
            outline: none;
            border-color: #667eea;
            box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
        }
        
        .form-options {
            display: flex;
            justify-content: space-between;
            align-items: center;
            margin-bottom: 25px;
            font-size: 13px;
        }
        
        .form-options label {
            display: flex;
            align-items: center;
            color: #666;
            cursor: pointer;
        }
        
        .form-options input[type="checkbox"] {
            margin-right: 5px;
        }
        
        .form-options a {
            color: #667eea;
            text-decoration: none;
            transition: color 0.3s ease;
        }
        
        .form-options a:hover {
            color: #764ba2;
            text-decoration: underline;
        }
        
        .btn-login {
            width: 100%;
            padding: 12px;
            background-color: #667eea;
            color: white;
            border: none;
            border-radius: 6px;
            font-size: 16px;
            font-weight: 600;
            cursor: pointer;
            transition: background-color 0.3s ease;
            font-family: inherit;
        }
        
        .btn-login:hover {
            background-color: #764ba2;
        }
        
        .btn-login:active {
            transform: translateY(1px);
        }
        
        .error-message {
            background-color: #f8d7da;
            color: #721c24;
            padding: 10px 15px;
            border-radius: 6px;
            margin-bottom: 20px;
            font-size: 14px;
            border: 1px solid #f5c6cb;
        }
        
        .success-message {
            background-color: #d4edda;
            color: #155724;
            padding: 10px 15px;
            border-radius: 6px;
            margin-bottom: 20px;
            font-size: 14px;
            border: 1px solid #c3e6cb;
        }
        
        .logo {
            width: 80px;
            height: 80px;
            margin: 0 auto 20px;
            display: block;
            border-radius: 50%;
            background-color: #f8f9fa;
            padding: 15px;
        }
        
        @media (max-width: 480px) {
            .login-container {
                padding: 30px 20px;
                margin: 20px;
            }
        }
    </style>
</head>
<body>
    <div class="login-container">
        <div class="login-header">
            <svg class="logo" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
                <path d="M12 2L2 7L12 12L22 7L12 2Z" stroke="#667eea" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
                <path d="M2 17L12 22L22 17" stroke="#667eea" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
                <path d="M2 12L12 17L22 12" stroke="#667eea" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
            </svg>
            <h2>博客管理系统</h2>
            <p>请输入您的管理员账号信息</p>
        </div>
        
        <?php if ((true && ($_smarty_tpl->hasVariable('errorMsg') && null !== ($_smarty_tpl->getValue('errorMsg') ?? null)))) {?><div class="error-message"><?php echo $_smarty_tpl->getValue('errorMsg');?>
</div><?php }?>
        <?php if ((true && ($_smarty_tpl->hasVariable('successMsg') && null !== ($_smarty_tpl->getValue('successMsg') ?? null)))) {?><div class="success-message"><?php echo $_smarty_tpl->getValue('successMsg');?>
</div><?php }?>
        
        <form id="loginForm" method="post">
            <div class="form-group">
                <label for="username">用户名</label>
                <input type="text" id="username" name="username" placeholder="请输入用户名" required>
            </div>
            
            <div class="form-group">
                <label for="password">密码</label>
                <input type="password" id="password" name="password" placeholder="请输入密码" required>
            </div>
            
            <div class="form-options">
                <label>
                    <input type="checkbox" name="remember" value="1"> 记住我
                </label>
                <a href="#" id="forgotPassword">忘记密码?</a>
            </div>
            
            <button type="submit" class="btn-login">登录</button>
        </form>
    </div>
    
    <?php echo '<script'; ?>
>
        document.addEventListener('DOMContentLoaded', function() {
            const loginForm = document.getElementById('loginForm');
            const forgotPasswordLink = document.getElementById('forgotPassword');
            
            // 表单提交处理（使用AJAX）
        loginForm.addEventListener('submit', function(e) {
            e.preventDefault(); // 阻止表单默认提交
            
            const username = document.getElementById('username').value.trim();
            const password = document.getElementById('password').value;
            const remember = document.getElementById('remember') ? document.getElementById('remember').checked : false;
            
            // 简单的客户端验证
            if (!username) {
                showMessage('请输入用户名', false);
                return;
            }
            
            if (!password) {
                showMessage('请输入密码', false);
                return;
            }
            
            // 禁用登录按钮，防止重复提交
            const loginButton = document.querySelector('.btn-login');
            loginButton.disabled = true;
            loginButton.textContent = '登录中...';
            
            // 发送AJAX请求
            const xhr = new XMLHttpRequest();
            xhr.open('POST', 'admin.php?c=Login&a=login', true);
            xhr.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
            
            xhr.onreadystatechange = function() {
                if (xhr.readyState === 4) {
                    // 恢复登录按钮状态
                    loginButton.disabled = false;
                    loginButton.textContent = '登录';
                    
                    if (xhr.status === 200) {
                        try {
                            const response = JSON.parse(xhr.responseText);
                            if (response.success) {
                                showMessage(response.message, true);
                                // 登录成功后延迟跳转
                                setTimeout(function() {
                                    window.location.href = 'admin.php?c=Index&a=index';
                                }, 1500);
                            } else {
                                showMessage(response.message, false);
                            }
                        } catch (e) {
                            showMessage('服务器响应格式错误', false);
                            console.error('JSON解析错误:', e);
                        }
                    } else {
                        showMessage('请求失败，请重试', false);
                    }
                }
            };
            
            // 构造请求参数
            const params = 'username=' + encodeURIComponent(username) +
                          '&password=' + encodeURIComponent(password) +
                          '&remember=' + (remember ? 1 : 0);
            
            xhr.send(params);
        });
        
        // 显示消息函数
        function showMessage(message, isSuccess) {
            // 清除已存在的消息
            const existingMessage = document.querySelector('.error-message, .success-message');
            if (existingMessage) {
                existingMessage.remove();
            }
            
            // 创建新消息元素
            const messageElement = document.createElement('div');
            messageElement.className = isSuccess ? 'success-message' : 'error-message';
            messageElement.textContent = message;
            
            // 插入到登录容器的顶部
            const loginContainer = document.querySelector('.login-container');
            const loginHeader = document.querySelector('.login-header');
            loginContainer.insertBefore(messageElement, loginHeader);
            
            // 添加淡入效果
            messageElement.style.opacity = '0';
            setTimeout(() => {
                messageElement.style.transition = 'opacity 0.3s ease';
                messageElement.style.opacity = '1';
            }, 10);
        }
            
            // 忘记密码链接处理
            // forgotPasswordLink.addEventListener('click', function(e) {
            //     e.preventDefault();
            //     alert('请联系系统管理员重置密码');
            // });
            
            // 添加一些交互效果
            const inputs = document.querySelectorAll('input[type="text"], input[type="password"]');
            inputs.forEach(input => {
                input.addEventListener('focus', function() {
                    this.parentElement.style.transform = 'translateY(-2px)';
                    this.parentElement.style.transition = 'transform 0.2s ease';
                });
                
                input.addEventListener('blur', function() {
                    this.parentElement.style.transform = 'translateY(0)';
                });
            });
        });
    <?php echo '</script'; ?>
>
</body>
</html><?php }
}
